package com.menhai.personmanagement.controller;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.menhai.personmanagement.entity.Codelist;
import com.menhai.personmanagement.entity.FollowupRecord;
import com.menhai.personmanagement.entity.MbReportCard;
import com.menhai.personmanagement.entity.ReportHealthcheck;
import com.menhai.personmanagement.entity.co.MbReportCardCO;
import com.menhai.personmanagement.entity.vo.HealthCheckVo;
import com.menhai.personmanagement.entity.vo.MbReportCardVo;
import com.menhai.personmanagement.services.FollowupRecordService;
import com.menhai.personmanagement.services.HealthCheckService;
import com.menhai.personmanagement.services.ICodelistService;
import com.menhai.personmanagement.services.IMbPopulationService;
import com.menhai.personmanagement.services.ReportCardService;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import cn.hutool.poi.excel.StyleSet;
import lombok.extern.slf4j.Slf4j;
/**
 * <p>
 * 报卡管理表 前端控制器
 * </p>
 *
 * @author shikun
 * @since 2021-11-25
 */

@Slf4j
@RestController
@RequestMapping("/healthCheck")
public class HealthCheckController {

     @Autowired
     private HealthCheckService healthCheckService;

     //新建慢病报卡
     @RequestMapping("/add")
     public Object addMbReportCard( ReportHealthcheck reportHealthcheck) throws Exception{
		 Map<String, Object> map = null;
		 //新建时间
		 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		 reportHealthcheck.setCreateTime(sdf.format(new Date()));
		 //健康体检表编号
		 reportHealthcheck.setHealthCheckNumber(sdf.format(new Date()).replace("-", "").replace(":", "").replace(" ", ""));
		 //新增慢病报卡
		 map = healthCheckService.addReportHealthcheck(reportHealthcheck);
		 return map;
     }
     
     
     //慢病报卡上报
     @RequestMapping("/edit")
     public Object edit(ReportHealthcheck reportHealthcheck) throws Exception{
 		 Map<String, Object> map = null;
 		 //修改时间
 		 SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 		 reportHealthcheck.setUpdateTime(formatter.format(new Date()));
 		 //编辑信息
 		 map = healthCheckService.updateHealthCheck(reportHealthcheck);
 		 return map;
     }
    
    
    /**
     * 查询健康体检信息列表
     * @param request
     * @param response
     * @param healthCheckVo
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getHealthCheckInfoList", method = RequestMethod.POST)
  	public Object getHealthCheckInfoList(HttpServletRequest request, HttpServletResponse response,HealthCheckVo healthCheckVo) throws Exception {
    	String hosnumarray = request.getParameter("hosnumarray");
    	healthCheckVo.setHosnumArray(hosnumarray.split(","));
    	healthCheckVo.setParamStr(hosnumarray);
    	IPage<HealthCheckVo> list = healthCheckService.getHealthCheckInfoList(healthCheckVo);
  		return list;
  	}
    
    /**
     * 根据体检id查询信息
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getOneByInspectphysicalId", method = RequestMethod.POST)
  	public Object getOneByInspectphysicalId(HttpServletRequest request, HttpServletResponse response) throws Exception {
    	//体检id
    	String inspectphysicalId = request.getParameter("inspectphysicalId");
    	return healthCheckService.getOneByInspectphysicalId(inspectphysicalId);
  	}
    
    
    /**
     * 获取责任医生列表
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getZedocList", method = RequestMethod.POST)
  	public Object getZedocList(HttpServletRequest request, HttpServletResponse response) throws Exception {
    	//医院编号
    	String hosnum = request.getParameter("hosnum");
    	return healthCheckService.getZedocList(hosnum);
  	}
    
    
    
    
    //导出excel
    @RequestMapping("/exportExcel")
    public void exportExcel(HttpServletRequest request, HttpServletResponse response) throws Exception{
    	String id = request.getParameter("id");
    	Map<String, String> exportInfo = healthCheckService.getExportInfo(id);
    	ExcelWriter writer = ExcelUtil.getWriter();
    	//去掉头部背景颜色
    	StyleSet styleSet = writer.getStyleSet();
    	styleSet.setBackgroundColor(IndexedColors.WHITE, true);
    	//内容字体大小
    	Font fontContent = writer.createFont();
    	fontContent.setFontHeight(Short.parseShort("240"));
    	CellStyle cellStyleContent = styleSet.getHeadCellStyle();
    	//自动换行
    	cellStyleContent.setWrapText(true);
    	//默认行高
    	writer.setDefaultRowHeight(28);
    	cellStyleContent.setFont(fontContent); 
    	
    	
    	if(exportInfo == null||exportInfo.size()==0){
    		throw new Exception("未查询到健康体检表信息");
    	}
    	//表格开始
    	List<String> header1 = new LinkedList<>();
    	header1.add("健康体检表");
    	header1.add("");
    	header1.add("");
    	header1.add("");
    	header1.add("");
    	header1.add("");
    	header1.add("");
    	header1.add("");
    	writer.writeHeadRow(header1);
    	writer.merge(0,0,0,7,null,false);
    	//第一行表名字体样式
    	Font font = writer.createFont();
    	font.setBold(true);
    	font.setFontHeight(Short.parseShort("400"));
    	CellStyle cellStyle = writer.getCellStyle();
    	cellStyle.setFont(font);
    	Cell cell = writer.getCell(0, 0);
    	cell.setCellStyle(cellStyle);
    	
    	List<String> header2 = new LinkedList<>();
    	header2.add("姓名:");
    	header2.add(nullToString(exportInfo.get("name")));
    	header2.add("身份证号码:");
    	header2.add(nullToString(exportInfo.get("idnumber")));
    	header2.add("联系电话:");
    	header2.add(nullToString(exportInfo.get("telephony")));
    	header2.add("现住址:");
    	header2.add(nullToString(exportInfo.get("newaddress")));
    	writer.writeHeadRow(header2);
    	List<String> header3 = new LinkedList<>();
    	header3.add("体检日期");
    	header3.add(nullToString(exportInfo.get("checkDate")));
    	header3.add("");
    	header3.add("");
    	header3.add("责任医生");
    	header3.add("");
    	header3.add(nullToString(exportInfo.get("doctorName")));
    	header3.add("");
    	writer.writeHeadRow(header3);
    	writer.merge(2,2,1,3,null,false);
    	writer.merge(2,2,4,5,null,false);
    	writer.merge(2,2,6,7,null,false);

    	
    	List<String> header4 = new LinkedList<>();
    	header4.add("内容");
    	header4.add("检查项目");
    	header4.add("");
    	header4.add("");
    	header4.add("");
    	header4.add("");
    	header4.add("");
    	header4.add("");
    	writer.writeHeadRow(header4);
//    	writer.merge(3,3,0,1,null,false);
    	writer.merge(3,3,1,7,null,false);
    	//症状
    	String basicSymptoms = exportInfo.get("basicSymptoms");
    	String bsRes = basicSymptoms(basicSymptoms);
    	List<String> header5 = new LinkedList<>();
    	header5.add("症状");
    	header5.add(bsRes);
    	header5.add("");
    	header5.add("");
    	header5.add("");
    	header5.add("");
    	header5.add("");
    	header5.add("");
    	writer.writeHeadRow(header5);
//    	writer.merge(4,4,0,1,null,false);
    	writer.merge(4,4,1,7,null,false);
    	List<String> header6 = new LinkedList<>();
    	header6.add("一般状况");
    	header6.add("体温");
    	header6.add("");
    	header6.add(nullToString(exportInfo.get("temperature"))+"°c");
    	header6.add("");
    	header6.add("脉率");
    	header6.add(nullToString(exportInfo.get("pulseFrequency"))+"次/分钟");
    	header6.add("");
    	writer.writeHeadRow(header6);	
    	writer.merge(5,13,0,0,null,false);//一般状况
    	writer.merge(5,5,1,2,null,false);
    	writer.merge(5,5,3,4,null,false);
    	writer.merge(5,5,6,7,null,false);
    	List<String> header7 = new LinkedList<>();
    	header7.add("");
    	header7.add("呼吸频率");
    	header7.add("");
    	header7.add(nullToString(exportInfo.get("breathingRate"))+"次/分钟");
    	header7.add("");
    	header7.add("血压");
    	header7.add("左侧");
    	header7.add(nullToString(exportInfo.get("leftBloodPressure1"))+"/"+nullToString(exportInfo.get("leftBloodPressure2"))+"mmHg");
    	writer.writeHeadRow(header7); 
//    	writer.merge(6,6,1,2,null,false);
    	List<String> header8 = new LinkedList<>();
    	header8.add("");
    	header8.add("");
    	header8.add("");
    	header8.add("");
    	header8.add("");
    	header8.add("");
    	header8.add("右侧");
    	header8.add(nullToString(exportInfo.get("rightBloodPressure1"))+"/"+nullToString(exportInfo.get("rightBloodPressure2"))+"mmHg");
    	writer.writeHeadRow(header8);  	
    	writer.merge(6,7,1,2,null,false);
    	writer.merge(6,7,3,4,null,false);
    	writer.merge(6,7,5,5,null,false);
    	List<String> header9 = new LinkedList<>();
    	header9.add("");
    	header9.add("身高");
    	header9.add("");
    	header9.add(nullToString(exportInfo.get("height"))+"cm");
    	header9.add("");
    	header9.add("体重");
    	header9.add(nullToString(exportInfo.get("weight"))+"kg");
    	header9.add("");
    	writer.writeHeadRow(header9);
    	writer.merge(8,8,1,2,null,false);
    	writer.merge(8,8,3,4,null,false);
    	writer.merge(8,8,6,7,null,false);
    	List<String> header10 = new LinkedList<>();
    	header10.add("");
    	header10.add("腰围");
    	header10.add("");
    	header10.add(nullToString(exportInfo.get("waistCircumference"))+"cm");
    	header10.add("");
    	header10.add("体质指数(BMI)");
    	header10.add(nullToString(exportInfo.get("bmi"))+"Kg/m²");
    	header10.add("");
    	writer.writeHeadRow(header10);
    	writer.merge(9,9,1,2,null,false);
    	writer.merge(9,9,3,4,null,false);
    	writer.merge(9,9,6,7,null,false);
    	List<String> header11 = new LinkedList<>();
    	header11.add("");
    	header11.add("老年人健康状态自我评估");
    	header11.add("");
    	header11.add(jkztRadio(exportInfo.get("jkztRadio")));
    	header11.add("");
    	header11.add("");
    	header11.add("");
    	header11.add("");
    	writer.writeHeadRow(header11);
    	writer.merge(10,10,1,2,null,false);
    	writer.merge(10,10,3,7,null,false);
    	
    	List<String> header12 = new LinkedList<>();
    	header12.add("");
    	header12.add("老年人生活自理能力自我评估");
    	header12.add("");
    	header12.add(zlnlRadio(exportInfo.get("zlnlRadio")));
    	header12.add("");
    	header12.add("");
    	header12.add("");
    	header12.add("");
    	writer.writeHeadRow(header12);
    	writer.merge(11,11,1,2,null,false);
    	writer.merge(11,11,3,7,null,false);
    	
    	
    	List<String> header13 = new LinkedList<>();
    	header13.add("");
    	header13.add("老年人认知功能");
    	header13.add("");
    	header13.add(rzgnRadio(exportInfo.get("rzgnRadio"))+"  简易智力状态检查，总分:"+nullToString(exportInfo.get("intelligenceTotal")));
    	header13.add("");
    	header13.add("");
    	header13.add("");
    	header13.add("");
    	writer.writeHeadRow(header13);
    	writer.merge(12,12,1,2,null,false);
    	writer.merge(12,12,3,7,null,false);
    	
    	
    	
    	List<String> header14 = new LinkedList<>();
    	header14.add("");
    	header14.add("老年人情感状态");
    	header14.add("");
    	header14.add(rzgnRadio(exportInfo.get("ggztRadio"))+"  老年人抑郁评分检查，总分:"+nullToString(exportInfo.get("depressionTotal")));
    	header14.add("");
    	header14.add("");
    	header14.add("");
    	header14.add("");
    	writer.writeHeadRow(header14);
    	writer.merge(13,13,1,2,null,false);
    	writer.merge(13,13,3,7,null,false);
    	
    	List<String> header15 = new LinkedList<>();
    	header15.add("生活方式");
    	header15.add("体育锻炼");
    	header15.add("");
    	header15.add("锻炼频率");
    	header15.add(exerciseRadio(exportInfo.get("exerciseRadio")));
    	header15.add("");
    	header15.add("");
    	header15.add("");
    	writer.writeHeadRow(header15);	
    	writer.merge(14,31,0,0,null,false);//生活方式
    	writer.merge(14,16,1,2,null,false);//体育锻炼
    	writer.merge(14,14,4,7,null,false);
    	
    	List<String> header16 = new LinkedList<>();
    	header16.add("");
    	header16.add("");
    	header16.add("");
    	header16.add("每次锻炼时间");
    	header16.add(nullToString(exportInfo.get("exerciseMinutes"))+"分钟");
    	header16.add("坚持锻炼时间");
    	header16.add(nullToString(exportInfo.get("exerciseYear"))+"年");
    	header16.add("");
    	writer.writeHeadRow(header16);	
    	writer.merge(15,15,6,7,null,false);
    	
    	
    	List<String> header17 = new LinkedList<>();
    	header17.add("");
    	header17.add("");
    	header17.add("");
    	header17.add("锻炼方式");
    	header17.add(nullToString(exportInfo.get("exerciseType")));
    	header17.add("");
    	header17.add("");
    	header17.add("");
    	writer.writeHeadRow(header17);	
    	writer.merge(16,16,4,7,null,false);
    	
    	List<String> header18 = new LinkedList<>();
    	header18.add("");
    	header18.add("饮食习惯");
    	header18.add("");
    	header18.add(dietRadio(nullToString(exportInfo.get("dietRadio"))));
    	header18.add("");
    	header18.add("");
    	header18.add("");
    	header18.add("");
    	writer.writeHeadRow(header18);	
    	writer.merge(17,17,1,2,null,false);
    	writer.merge(17,17,3,7,null,false);
    	
    	
    	List<String> header19 = new LinkedList<>();
    	header19.add("");
    	header19.add("吸烟情况");
    	header19.add("");
    	header19.add("吸烟状况");
    	header19.add(smokeRadio(exportInfo.get("smokeRadio")));
    	header19.add("");
    	header19.add("");
    	header19.add("");
    	writer.writeHeadRow(header19);	
    	writer.merge(18,20,1,2,null,false);//吸烟情况
    	writer.merge(18,18,4,7,null,false);
    	
    	List<String> header20 = new LinkedList<>();
    	header20.add("");
    	header20.add("");
    	header20.add("");
    	header20.add("日吸烟量");
    	header20.add("平均 "+nullToString(exportInfo.get("averageSmoke"))+" 支");
    	header20.add("");
    	header20.add("");
    	header20.add("");
    	writer.writeHeadRow(header20);	
    	writer.merge(19,19,4,7,null,false);
    	
    	List<String> header21 = new LinkedList<>();
    	header21.add("");
    	header21.add("");
    	header21.add("");
    	header21.add("开始吸烟年龄");
    	header21.add(nullToString(exportInfo.get("smokeAge"))+"岁");
    	header21.add("戒烟年龄");
    	header21.add(nullToString(exportInfo.get("noSmokeAge"))+"岁");
    	header21.add("");
    	writer.writeHeadRow(header21);
    	writer.merge(20,20,6,7,null,false);
    	
    	List<String> header22 = new LinkedList<>();
    	header22.add("");
    	header22.add("饮酒情况");
    	header22.add("");
    	header22.add("饮酒频率");
    	header22.add(drinkingRadio(exportInfo.get("drinkingRadio")));
    	header22.add("");
    	header22.add("");
    	header22.add("");
    	writer.writeHeadRow(header22);
    	writer.merge(21,25,1,2,null,false);
    	writer.merge(21,21,4,7,null,false);
    	
    	
    	List<String> header23 = new LinkedList<>();
    	header23.add("");
    	header23.add("");
    	header23.add("");
    	header23.add("日饮酒量");
    	header23.add("平均 "+nullToString(exportInfo.get("averageDrinking"))+" 两");
    	header23.add("");
    	header23.add("");
    	header23.add("");
    	writer.writeHeadRow(header23);
    	writer.merge(22,22,4,7,null,false);
    	
    	
    	List<String> header24 = new LinkedList<>();
    	header24.add("");
    	header24.add("");
    	header24.add("");
    	header24.add("是否戒酒");
    	header24.add(noDrinkingRadio(exportInfo.get("noDrinkingRadio"),exportInfo.get("noDrinkingAge")));
    	header24.add("");
    	header24.add("");
    	header24.add("");
    	writer.writeHeadRow(header24);
    	writer.merge(23,23,4,7,null,false);
    	
    	
    	List<String> header25 = new LinkedList<>();
    	header25.add("");
    	header25.add("");
    	header25.add("");
    	header25.add("开始饮酒年龄");
    	header25.add(nullToString(exportInfo.get("drinkingAge"))+"岁");
    	header25.add("近一年内是否曾醉酒");
    	header25.add(drunkRadio(exportInfo.get("drunkRadio")));
    	header25.add("");
    	writer.writeHeadRow(header25);
    	writer.merge(24,24,6,7,null,false);
    	
    	List<String> header26 = new LinkedList<>();
    	header26.add("");
    	header26.add("");
    	header26.add("");
    	header26.add("饮酒种类");
    	header26.add(drinkingTypeRadio(exportInfo.get("drinkingTypeRadio")));
    	header26.add("");
    	header26.add("");
    	header26.add("");
    	writer.writeHeadRow(header26);
    	writer.merge(25,25,4,7,null,false);
    	
    	
    	List<String> header27 = new LinkedList<>();
    	header27.add("");
    	header27.add("职业病危害因素接触史");
    	header27.add("");
    	header27.add(zybRadio(exportInfo.get("zybRadio")));
    	header27.add("（工种 "+nullToString(exportInfo.get("workType"))+" 从业时间"+nullToString(exportInfo.get("workYear"))+"年）");
    	header27.add("");
    	header27.add("");
    	header27.add("");
    	writer.writeHeadRow(header27);
    	writer.merge(26,31,1,2,null,false); //职业病危害因素接触史
    	writer.merge(26,26,4,7,null,false);
    	List<String> header28 = new LinkedList<>();
    	header28.add("");
    	header28.add("");
    	header28.add("");
    	header28.add("毒物种类");
    	header28.add("粉尘   "+nullToString(exportInfo.get("fc"))+"  防护措施  "+dwRadio(exportInfo.get("fccsRadio")));
    	header28.add("");
    	header28.add("");
    	header28.add("");
    	writer.writeHeadRow(header28);
    	writer.merge(27,27,4,7,null,false);
    	writer.merge(27,31,3,3,null,false);//毒物种类
    	List<String> header29 = new LinkedList<>(); 
    	header29.add("");
    	header29.add("");
    	header29.add("");
    	header29.add("");
    	header29.add("放射物质   "+nullToString(exportInfo.get("fswz"))+"  防护措施  "+dwRadio(exportInfo.get("fswzRadio")));
    	header29.add("");
    	header29.add("");
    	header29.add("");
    	writer.writeHeadRow(header29);
    	writer.merge(28,28,4,7,null,false);
    	List<String> header30 = new LinkedList<>();
    	header30.add("");
    	header30.add("");
    	header30.add("");
    	header30.add("");
    	header30.add("物理因素   "+nullToString(exportInfo.get("wlys"))+"  防护措施  "+dwRadio(exportInfo.get("wlysRadio")));
    	header30.add("");
    	header30.add("");
    	header30.add("");
    	writer.writeHeadRow(header30);
    	writer.merge(29,29,4,7,null,false);
    	List<String> header31 = new LinkedList<>();
    	header31.add("");
    	header31.add("");
    	header31.add("");
    	header31.add("");
    	header31.add("化学物质   "+nullToString(exportInfo.get("hxwz"))+"  防护措施  "+dwRadio(exportInfo.get("hxwzRadio")));
    	header31.add("");
    	header31.add("");
    	header31.add("");
    	writer.writeHeadRow(header31);
    	writer.merge(30,30,4,7,null,false);
    	List<String> header32 = new LinkedList<>();
    	header32.add("");
    	header32.add("");
    	header32.add("");
    	header32.add("");
    	header32.add("其他   "+nullToString(exportInfo.get("dwqt"))+"  防护措施  "+dwRadio(exportInfo.get("dwqtRadio")));
    	header32.add("");
    	header32.add("");
    	header32.add("");
    	writer.writeHeadRow(header32);
    	writer.merge(31,31,4,7,null,false);
    	
    	
    	List<String> header33 = new LinkedList<>();
    	header33.add("脏器功能");
    	header33.add("口腔");
    	header33.add("");
    	header33.add("口唇");
    	header33.add(kcRadio(exportInfo.get("kcRadio")));
    	header33.add("");
    	header33.add("");
    	header33.add("");
    	writer.writeHeadRow(header33);
    	writer.merge(32,37,0,0,null,false);//脏器功能
    	writer.merge(32,34,1,2,null,false);//口腔
    	writer.merge(32,32,4,7,null,false);
    	List<String> header34 = new LinkedList<>();
    	header34.add("");
    	header34.add("");
    	header34.add("");
    	header34.add("齿列");
    	header34.add(clRadio(exportInfo.get("clRadio")));
    	header34.add("");
    	header34.add("");
    	header34.add("");
    	writer.writeHeadRow(header34);
    	writer.merge(33,33,4,7,null,false);
    	List<String> header35 = new LinkedList<>();
    	header35.add("");
    	header35.add("");
    	header35.add("");
    	header35.add("咽部");
    	header35.add(ybRadio(exportInfo.get("ybRadio")));
    	header35.add("");
    	header35.add("");
    	header35.add("");
    	writer.writeHeadRow(header35);
    	writer.merge(34,34,4,7,null,false);
    	List<String> header36 = new LinkedList<>();
    	header36.add("");
    	header36.add("视力");
    	header36.add("");
    	header36.add("左眼 "+nullToString(exportInfo.get("leftEye"))+" 右眼 "+nullToString(exportInfo.get("rightEye"))+" （矫正视力：左眼 "+nullToString(exportInfo.get("correctLeftEye"))+"  右眼 "+nullToString(exportInfo.get("correctRightEye"))+" ）");
    	header36.add("");
    	header36.add("");
    	header36.add("");
    	header36.add("");
    	writer.writeHeadRow(header36);
    	writer.merge(35,35,1,2,null,false);
    	writer.merge(35,35,3,7,null,false);
    	List<String> header37 = new LinkedList<>();
    	header37.add("");
    	header37.add("听力");
    	header37.add("");
    	header37.add(tlRadio(exportInfo.get("tlRadio")));
    	header37.add("");
    	header37.add("");
    	header37.add("");
    	header37.add("");
    	writer.writeHeadRow(header37);
    	writer.merge(36,36,1,2,null,false);
    	writer.merge(36,36,3,7,null,false);
    	List<String> header38 = new LinkedList<>();
    	header38.add("");
    	header38.add("运动功能");
    	header38.add("");
    	header38.add(ydgnRadio(exportInfo.get("ydgnRadio")));
    	header38.add("");
    	header38.add("");
    	header38.add("");
    	header38.add("");
    	writer.writeHeadRow(header38);
    	writer.merge(37,37,1,2,null,false);
    	writer.merge(37,37,3,7,null,false);
    	
    	
    	List<String> header39 = new LinkedList<>();
    	header39.add("查体");
    	header39.add("眼底");
    	header39.add("");
    	header39.add(ydRadio(exportInfo.get("ydRadio"))+"  "+nullToString(exportInfo.get("ydAbnormal")));
    	header39.add("");
    	header39.add("");
    	header39.add("");
    	header39.add("");
    	writer.writeHeadRow(header39);
    	writer.merge(38,53,0,0,null,false);//查体
    	writer.merge(38,38,1,2,null,false);
    	writer.merge(38,38,3,7,null,false);
    	List<String> header40 = new LinkedList<>();
    	header40.add("");
    	header40.add("皮肤");
    	header40.add("");
    	header40.add(pfRadio(exportInfo.get("pfRadio"))+"  "+nullToString(exportInfo.get("pfOther")));
    	header40.add("");
    	header40.add("");
    	header40.add("");
    	header40.add("");
    	writer.writeHeadRow(header40);
    	writer.merge(39,39,1,2,null,false);
    	writer.merge(39,39,3,7,null,false);
    	List<String> header41 = new LinkedList<>();
    	header41.add("");
    	header41.add("巩膜");
    	header41.add("");
    	header41.add(hmRadio(exportInfo.get("hmRadio"))+"  "+nullToString(exportInfo.get("hmOther")));
    	header41.add("");
    	header41.add("");
    	header41.add("");
    	header41.add("");
    	writer.writeHeadRow(header41);
    	writer.merge(40,40,1,2,null,false);
    	writer.merge(40,40,3,7,null,false);
    	List<String> header42 = new LinkedList<>();
    	header42.add("");
    	header42.add("淋巴结");
    	header42.add("");
    	header42.add(lbjRadio(exportInfo.get("lbjRadio"))+"  "+nullToString(exportInfo.get("lbjOther")));
    	header42.add("");
    	header42.add("");
    	header42.add("");
    	header42.add("");
    	writer.writeHeadRow(header42);
    	writer.merge(41,41,1,2,null,false);
    	writer.merge(41,41,3,7,null,false);
    	List<String> header43 = new LinkedList<>();
    	header43.add("");
    	header43.add("肺");
    	header43.add("");
    	header43.add("桶状胸");
    	header43.add(tzxRadio(exportInfo.get("tzxRadio")));
    	header43.add("");
    	header43.add("");
    	header43.add("");
    	writer.writeHeadRow(header43);
    	writer.merge(42,44,1,2,null,false);
    	writer.merge(42,42,4,7,null,false);
    	List<String> header44 = new LinkedList<>();
    	header44.add("");
    	header44.add("");
    	header44.add("");
    	header44.add("呼吸音");
    	header44.add(hxyRadio(exportInfo.get("hxyRadio"))+"  "+nullToString(exportInfo.get("hxyAbnormal")));
    	header44.add("");
    	header44.add("");
    	header44.add("");
    	writer.writeHeadRow(header44);
    	writer.merge(43,43,4,7,null,false);
    	List<String> header45 = new LinkedList<>();
    	header45.add("");
    	header45.add("");
    	header45.add("");
    	header45.add("罗音");
    	header45.add(lyRadio(exportInfo.get("lyRadio"))+"  "+nullToString(exportInfo.get("lyOther")));
    	header45.add("");
    	header45.add("");
    	header45.add("");
    	writer.writeHeadRow(header45);
    	writer.merge(44,44,4,7,null,false);
    	List<String> header46 = new LinkedList<>();
    	header46.add("");
    	header46.add("心脏");
    	header46.add("");
    	header46.add("心率");
    	header46.add(nullToString(exportInfo.get("heartRate"))+"次/分钟    心律："+xlradio(exportInfo.get("xlradio")));
    	header46.add("");
    	header46.add("");
    	header46.add("");
    	writer.writeHeadRow(header46);
    	writer.merge(45,46,1,2,null,false);
    	writer.merge(45,45,4,7,null,false);
    	List<String> header47 = new LinkedList<>();
    	header47.add("");
    	header47.add("");
    	header47.add("");
    	header47.add("杂音");
    	header47.add(zybRadio(exportInfo.get("zyRadio"))+"  "+nullToString(exportInfo.get("zyText")));
    	header47.add("");
    	header47.add("");
    	header47.add("");
    	writer.writeHeadRow(header47);
    	writer.merge(46,46,4,7,null,false);
    	List<String> header48 = new LinkedList<>();
    	header48.add("");
    	header48.add("腹部");
    	header48.add("");
    	header48.add("压痛");
    	header48.add(zybRadio(exportInfo.get("ytRadio"))+"  "+nullToString(exportInfo.get("ytText")));
    	header48.add("");
    	header48.add("");
    	header48.add("");
    	writer.writeHeadRow(header48);
    	writer.merge(47,51,1,2,null,false);
    	writer.merge(47,47,4,7,null,false);
    	List<String> header49 = new LinkedList<>();
    	header49.add("");
    	header49.add("");
    	header49.add("");
    	header49.add("包块");
    	header49.add(zybRadio(exportInfo.get("bkRadio"))+"  "+nullToString(exportInfo.get("bkText")));
    	header49.add("");
    	header49.add("");
    	header49.add("");
    	writer.writeHeadRow(header49);
    	writer.merge(48,48,4,7,null,false);
    	List<String> header50 = new LinkedList<>();
    	header50.add("");
    	header50.add("");
    	header50.add("");
    	header50.add("肝大");
    	header50.add(zybRadio(exportInfo.get("gdRadio"))+"  "+nullToString(exportInfo.get("gdText")));
    	header50.add("");
    	header50.add("");
    	header50.add("");
    	writer.writeHeadRow(header50);
    	writer.merge(49,49,4,7,null,false);
    	List<String> header51 = new LinkedList<>();
    	header51.add("");
    	header51.add("");
    	header51.add("");
    	header51.add("脾大");
    	header51.add(zybRadio(exportInfo.get("pdRadio"))+"  "+nullToString(exportInfo.get("pdText")));
    	header51.add("");
    	header51.add("");
    	header51.add("");
    	writer.writeHeadRow(header51);
    	writer.merge(50,50,4,7,null,false);
    	List<String> header52 = new LinkedList<>();
    	header52.add("");
    	header52.add("");
    	header52.add("");
    	header52.add("移动性浊音");
    	header52.add(zybRadio(exportInfo.get("ydxzyRadio"))+"  "+nullToString(exportInfo.get("ydxzyText")));
    	header52.add("");
    	header52.add("");
    	header52.add("");
    	writer.writeHeadRow(header52);
    	writer.merge(51,51,4,7,null,false);
    	List<String> header53 = new LinkedList<>();
    	header53.add("");
    	header53.add("下肢水肿");
    	header53.add("");
    	header53.add(xzszRadio(exportInfo.get("xzszRadio")));
    	header53.add("");
    	header53.add("");
    	header53.add("");
    	header53.add("");
    	writer.writeHeadRow(header53);
    	writer.merge(52,52,1,2,null,false);
    	writer.merge(52,52,3,7,null,false);
    	List<String> header54 = new LinkedList<>();
    	header54.add("");
    	header54.add("足背动脉搏动");
    	header54.add("");
    	header54.add(zbdmbdRadio(exportInfo.get("zbdmbdRadio")));
    	header54.add("");
    	header54.add("");
    	header54.add("");
    	header54.add("");
    	writer.writeHeadRow(header54);
    	writer.merge(53,53,1,2,null,false);
    	writer.merge(53,53,3,7,null,false); 
    	
    	
    	List<String> header55 = new LinkedList<>();
    	header55.add("辅助检查");
    	header55.add("血常规");
    	header55.add("");
    	header55.add("血红蛋白 "+nullToString(exportInfo.get("hemoglobin"))+" g/L 白细胞 "+nullToString(exportInfo.get("whiteCells"))+" ×10^9/L 血小板 "+nullToString(exportInfo.get("platelet"))+" ×10^9/L 其他 "+nullToString(exportInfo.get("xcgOther")));
    	header55.add("");
    	header55.add("");
    	header55.add("");
    	header55.add("");
    	writer.writeHeadRow(header55);
    	writer.merge(54,63,0,0,null,false);//辅助检查
    	writer.merge(54,54,1,2,null,false); 
    	writer.merge(54,54,3,7,null,false); 
    	List<String> header56 = new LinkedList<>();
    	header56.add("");
    	header56.add("尿常规");
    	header56.add("");
    	header56.add("尿蛋白 "+nullToString(exportInfo.get("urineProtein"))+" 尿糖 "+nullToString(exportInfo.get("urineSugar"))+" 尿酮体 "+nullToString(exportInfo.get("urineKetoneBody"))+" 尿潜血 "+nullToString(exportInfo.get("ery"))+" 其他 "+nullToString(exportInfo.get("ncgOther")));
    	header56.add("");
    	header56.add("");
    	header56.add("");
    	header56.add("");
    	writer.writeHeadRow(header56);
    	writer.merge(55,55,1,2,null,false);
    	writer.merge(55,55,3,7,null,false); 
    	List<String> header57 = new LinkedList<>();
    	header57.add("");
    	header57.add("空腹血糖");
    	header57.add("");
    	header57.add(nullToString(exportInfo.get("bloodSugar1"))+" mmol/L 或  "+nullToString(exportInfo.get("bloodSugar2"))+" mg/dL");
    	header57.add("");
    	header57.add("");
    	header57.add("");
    	header57.add("");
    	writer.writeHeadRow(header57);
    	writer.merge(56,56,1,2,null,false);
    	writer.merge(56,56,3,7,null,false); 
    	List<String> header58 = new LinkedList<>();
    	header58.add("");
    	header58.add("心电图");
    	header58.add("");
    	header58.add(ydRadio(exportInfo.get("ecgRadio"))+"  "+nullToString(exportInfo.get("ecgAbnormal")));
    	header58.add("");
    	header58.add("");
    	header58.add("");
    	header58.add("");
    	writer.writeHeadRow(header58);
    	writer.merge(57,57,1,2,null,false);
    	writer.merge(57,57,3,7,null,false); 
    	List<String> header60 = new LinkedList<>();
    	header60.add("");
    	header60.add("肝功能");
    	header60.add("");
    	header60.add("血清谷丙转氨酶 "+nullToString(exportInfo.get("xqgbzam"))+" U/L       血清谷草转氨酶 "+nullToString(exportInfo.get("xqgczam"))+" U/L     总胆红素 "+nullToString(exportInfo.get("zdhs"))+" μmol/L");
    	header60.add("");
    	header60.add("");
    	header60.add("");
    	header60.add("");
    	writer.writeHeadRow(header60);
    	writer.merge(58,58,1,2,null,false);
    	writer.merge(58,58,3,7,null,false);
    	List<String> header61 = new LinkedList<>();
    	header61.add("");
    	header61.add("肾功能");
    	header61.add("");
    	header61.add("血清肌酐 "+nullToString(exportInfo.get("xqjg"))+" μmol/L     血尿素 "+nullToString(exportInfo.get("xns"))+" mmol/L");
    	header61.add("");
    	header61.add("");
    	header61.add("");
    	header61.add("");
    	writer.writeHeadRow(header61);
    	writer.merge(59,59,1,2,null,false);
    	writer.merge(59,59,3,7,null,false); 
    	List<String> header62 = new LinkedList<>();
    	header62.add("");
    	header62.add("血脂");
    	header62.add("");
    	header62.add("总胆固醇 "+nullToString(exportInfo.get("zdgc"))+" mmol/L     甘油三酯"+nullToString(exportInfo.get("gysz"))+"  mmol/L");
    	header62.add("");
    	header62.add("");
    	header62.add("");
    	header62.add("");
    	writer.writeHeadRow(header62);
    	writer.merge(60,62,1,2,null,false);
    	writer.merge(60,60,3,7,null,false);
    	List<String> header63 = new LinkedList<>();
    	header63.add("");
    	header63.add("");
    	header63.add("");
    	header63.add("血清低密度脂蛋白胆固醇 "+nullToString(exportInfo.get("xqdmdzdbdgc"))+" mmol/L");
    	header63.add("");
    	header63.add("");
    	header63.add("");
    	header63.add("");
    	writer.writeHeadRow(header63);
    	writer.merge(61,61,3,7,null,false);
    	List<String> header64 = new LinkedList<>();
    	header64.add("");
    	header64.add("");
    	header64.add("");
    	header64.add("血清高密度脂蛋白胆固醇 "+nullToString(exportInfo.get("xqgmdzdbdgc"))+" mmol/L");
    	header64.add("");
    	header64.add("");
    	header64.add("");
    	header64.add("");
    	writer.writeHeadRow(header64);
    	writer.merge(62,62,3,7,null,false);
    	List<String> header65 = new LinkedList<>();
    	header65.add("");
    	header65.add("B   超");
    	header65.add("");
    	header65.add("腹部B超 "+ydRadio(exportInfo.get("fbbcRadio"))+" "+nullToString(exportInfo.get("fbbcAbnormal")));
    	header65.add("");
    	header65.add("");
    	header65.add("");
    	header65.add("");
    	writer.writeHeadRow(header65);
    	writer.merge(63,63,1,2,null,false);
    	writer.merge(63,63,3,7,null,false);
    	
    	
    	List<String> header66 = new LinkedList<>();
    	header66.add("现存主要健康问题(问诊)");
    	header66.add("脑血管疾病");
    	header66.add("");
    	header66.add(nxgjbRadio(exportInfo.get("nxgjbRadio")));
    	header66.add("");
    	header66.add("");
    	header66.add("");
    	header66.add("");
    	writer.writeHeadRow(header66);
    	writer.merge(64,74,0,0,null,false); //现存主要健康问题(问诊)
    	writer.merge(64,65,1,2,null,false);
    	writer.merge(64,64,3,7,null,false);
    	
    	List<String> header67 = new LinkedList<>();
    	header67.add("");
    	header67.add("");
    	header67.add("");
    	header67.add(nullToString(exportInfo.get("nxgjbOther")));
    	header67.add("");
    	header67.add("");
    	header67.add("");
    	header67.add("");
    	writer.writeHeadRow(header67);
    	writer.merge(65,65,3,7,null,false);
    	
    	
    	List<String> header68 = new LinkedList<>();
    	header68.add("");
    	header68.add("肾脏疾病");
    	header68.add("");
    	header68.add(szjbRadio(exportInfo.get("szjbRadio")));
    	header68.add("");
    	header68.add("");
    	header68.add("");
    	header68.add("");
    	writer.writeHeadRow(header68);
    	writer.merge(66,67,1,2,null,false);
    	writer.merge(66,66,3,7,null,false);
    	
    	List<String> header69 = new LinkedList<>();
    	header69.add("");
    	header69.add("");
    	header69.add("");
    	header69.add(nullToString(exportInfo.get("szjbOther")));
    	header69.add("");
    	header69.add("");
    	header69.add("");
    	header69.add("");
    	writer.writeHeadRow(header69);
    	writer.merge(67,67,3,7,null,false);
    	
    	
    	List<String> header70= new LinkedList<>();
    	header70.add("");
    	header70.add("心脏疾病");
    	header70.add("");
    	header70.add(xzjbRadio(exportInfo.get("xzjbRadio")));
    	header70.add("");
    	header70.add("");
    	header70.add("");
    	header70.add("");
    	writer.writeHeadRow(header70);
    	writer.merge(68,69,1,2,null,false);
    	writer.merge(68,68,3,7,null,false);
    	
    	
    	List<String> header71= new LinkedList<>();
    	header71.add("");
    	header71.add("");
    	header71.add("");
    	header71.add(nullToString(exportInfo.get("xzjbOther")));
    	header71.add("");
    	header71.add("");
    	header71.add("");
    	header71.add("");
    	writer.writeHeadRow(header71);
    	writer.merge(69,69,3,7,null,false);
    	List<String> header72= new LinkedList<>();
    	header72.add("");
    	header72.add("血管疾病");
    	header72.add("");
    	header72.add(xgjbRadio(exportInfo.get("xgjbRadio"))+"  "+nullToString(exportInfo.get("xgjbOther")));
    	header72.add("");
    	header72.add("");
    	header72.add("");
    	header72.add("");
    	writer.writeHeadRow(header72);
    	writer.merge(70,70,1,2,null,false);
    	writer.merge(70,70,3,7,null,false);
    	List<String> header73= new LinkedList<>();
    	header73.add("");
    	header73.add("眼部疾病");
    	header73.add("");
    	header73.add(ybjbRadio(exportInfo.get("ybjbRadio")));
    	header73.add("");
    	header73.add("");
    	header73.add("");
    	header73.add("");
    	writer.writeHeadRow(header73);
    	writer.merge(71,72,1,2,null,false);
    	writer.merge(71,71,3,7,null,false);
    	List<String> header74= new LinkedList<>();
    	header74.add("");
    	header74.add("");
    	header74.add("");
    	header74.add(nullToString(exportInfo.get("ybjbOther")));
    	header74.add("");
    	header74.add("");
    	header74.add("");
    	header74.add("");
    	writer.writeHeadRow(header74);
    	writer.merge(72,72,3,7,null,false);
    	List<String> header75= new LinkedList<>();
    	header75.add("");
    	header75.add("神经系统疾病");
    	header75.add("");
    	header75.add(sjxtjbRadio(exportInfo.get("sjxtjbRadio"))+"  "+nullToString(exportInfo.get("sjxtjbtText")));
    	header75.add("");
    	header75.add("");
    	header75.add("");
    	header75.add("");
    	writer.writeHeadRow(header75);
    	writer.merge(73,73,1,2,null,false);
    	writer.merge(73,73,3,7,null,false);
    	List<String> header76= new LinkedList<>();
    	header76.add("");
    	header76.add("其他系统疾病");
    	header76.add("");
    	header76.add(sjxtjbRadio(exportInfo.get("qtxtjbRadio"))+"  "+nullToString(exportInfo.get("qtxtjbText")));
    	header76.add("");
    	header76.add("");
    	header76.add("");
    	header76.add("");
    	writer.writeHeadRow(header76);
    	writer.merge(74,74,1,2,null,false);
    	writer.merge(74,74,3,7,null,false);   	
    	
    	List<String> header77= new LinkedList<>();
    	header77.add("住院治疗情况（问诊）");
    	header77.add("住院史");
    	header77.add("");
    	header77.add("入/出院日期");
    	header77.add("原因");
    	header77.add("医疗机构名称");
    	header77.add("病案号");
    	header77.add("");
    	writer.writeHeadRow(header77);
    	writer.merge(75,80,0,0,null,false); //住院治疗情况（问诊）
    	writer.merge(75,77,1,2,null,false);
    	writer.merge(75,75,6,7,null,false);
    	//住院治疗情况
    	List<Map<String, Object>> exportHosInfo = healthCheckService.getExportHosInfo("1",id);
    	List<Map<String, Object>> healthCheckHos = healthCheckHos(exportHosInfo);
    	Map<String, Object> row1 = healthCheckHos.get(0);
    	List<String> header78= new LinkedList<>();
    	header78.add("");
    	header78.add("");
    	header78.add("");
    	header78.add(row1.get("inHospital")+"/"+row1.get("outHospital"));
    	header78.add(row1.get("why").toString());
    	header78.add(row1.get("hosName").toString());
    	header78.add(row1.get("medNo").toString());
    	header78.add("");
    	writer.writeHeadRow(header78);
    	writer.merge(76,76,6,7,null,false);
    	Map<String, Object> row2 = healthCheckHos.get(1);
    	List<String> header79= new LinkedList<>();
    	header79.add("");
    	header79.add("");
    	header79.add("");
    	header79.add(row2.get("inHospital")+"/"+row2.get("outHospital"));
    	header79.add(row2.get("why").toString());
    	header79.add(row2.get("hosName").toString());
    	header79.add(row2.get("medNo").toString());
    	header79.add("");
    	writer.writeHeadRow(header79);
    	writer.merge(77,77,6,7,null,false);
    	List<String> header80= new LinkedList<>();
    	header80.add("");
    	header80.add("家庭病床史");
    	header80.add("");
    	header80.add("建/撤床日期");
    	header80.add("原 因");
    	header80.add("医疗机构名称");
    	header80.add("病案号");
    	header80.add("");
    	writer.writeHeadRow(header80);
    	writer.merge(78,80,1,2,null,false);
    	writer.merge(78,78,6,7,null,false);
    	List<String> header81= new LinkedList<>();
    	List<Map<String, Object>> exportHosInfo2 = healthCheckService.getExportHosInfo("2",id);
    	List<Map<String, Object>> healthCheckHos2 = healthCheckHos(exportHosInfo2);
    	Map<String, Object> row3 = healthCheckHos2.get(0);
    	header81.add("");
    	header81.add("");
    	header81.add("");
    	header81.add(row3.get("inHospital")+"/"+row3.get("outHospital"));
    	header81.add(row3.get("why").toString());
    	header81.add(row3.get("hosName").toString());
    	header81.add(row3.get("medNo").toString());
    	header81.add("");
    	writer.writeHeadRow(header81);
    	writer.merge(79,79,6,7,null,false);
    	Map<String, Object> row4 = healthCheckHos2.get(1);
    	List<String> header82= new LinkedList<>();
    	header82.add("");
    	header82.add("");
    	header82.add("");
    	header82.add(row4.get("inHospital")+"/"+row4.get("outHospital"));
    	header82.add(row4.get("why").toString());
    	header82.add(row4.get("hosName").toString());
    	header82.add(row4.get("medNo").toString());
    	header82.add("");
    	writer.writeHeadRow(header82);
    	writer.merge(80,80,6,7,null,false);
    	
    	
    	List<String> header83= new LinkedList<>();
    	header83.add("主要用药情况（问诊）");
    	header83.add("药物名称");
    	header83.add("");
    	header83.add("用法");
    	header83.add("用量");
    	header83.add("用药时间");
    	header83.add("服药依从性");
    	header83.add("");
    	writer.writeHeadRow(header83);
    	writer.merge(81,84,0,0,null,false); //主要用药情况（问诊）
    	writer.merge(81,82,1,2,null,false);
    	writer.merge(81,81,6,7,null,false);
    	List<String> header84= new LinkedList<>();
    	header84.add("");
    	header84.add("");
    	header84.add("");
    	header84.add("");
    	header84.add("");
    	header84.add("");
    	header84.add("1规律　2间断　3不服药");
    	header84.add("");
    	writer.writeHeadRow(header84);
    	writer.merge(82,82,6,7,null,false);
    	writer.merge(81,82,3,3,null,false);
    	writer.merge(81,82,4,4,null,false);
    	writer.merge(81,82,5,5,null,false);
    	List<Map<String, Object>> exportMedInfo = healthCheckService.getExportMedInfo(id);
    	List<Map<String, Object>> healthCheckMed = healthCheckMed(exportMedInfo);
    	Map<String, Object> med1 = healthCheckMed.get(0);
    	List<String> header85= new LinkedList<>();
    	header85.add("");
    	header85.add(med1.get("medName").toString());
    	header85.add("");
    	header85.add(med1.get("useWay").toString());
    	header85.add(med1.get("useNum").toString());
    	header85.add(med1.get("useTime").toString());
    	header85.add(med1.get("fyycxRadio").toString());
    	header85.add("");
    	writer.writeHeadRow(header85);
    	writer.merge(83,83,1,2,null,false);
    	writer.merge(83,83,6,7,null,false);
    	Map<String, Object> med2 = healthCheckMed.get(1);
    	List<String> header86= new LinkedList<>();
    	header86.add("");
    	header86.add(med2.get("medName").toString());
    	header86.add("");
    	header86.add(med2.get("useWay").toString());
    	header86.add(med2.get("useNum").toString());
    	header86.add(med2.get("useTime").toString());
    	header86.add(med2.get("fyycxRadio").toString());
    	header86.add("");
    	writer.writeHeadRow(header86);
    	writer.merge(84,84,1,2,null,false);
    	writer.merge(84,84,6,7,null,false);

    	List<Map<String, Object>> exportVaccineInfo = healthCheckService.getExportVaccineInfo(id);
    	List<Map<String, Object>> healthCheckVaccine = healthCheckVaccine(exportVaccineInfo);
    	List<String> header91= new LinkedList<>();
    	header91.add("非免疫规划预防接种史（问诊）");
    	header91.add("名称");
    	header91.add("");
    	header91.add("接种日期");
    	header91.add("接种机构");
    	header91.add("");
    	header91.add("");
    	header91.add("");
    	writer.writeHeadRow(header91);
    	writer.merge(85,87,0,0,null,false);
    	writer.merge(85,85,1,2,null,false);
    	writer.merge(85,85,4,7,null,false);
    	Map<String, Object> vaccine1 = healthCheckVaccine.get(0);
    	List<String> header92= new LinkedList<>();
    	header92.add("非免疫规划预防接种史（问诊）");
    	header92.add(vaccine1.get("vaccineName").toString());
    	header92.add("");
    	header92.add(vaccine1.get("vaccineTime").toString());
    	header92.add(vaccine1.get("vaccinehos").toString());
    	header92.add("");
    	header92.add("");
    	header92.add("");
    	writer.writeHeadRow(header92);
    	writer.merge(86,86,1,2,null,false);
    	writer.merge(86,86,4,7,null,false);
    	
    	Map<String, Object> vaccine2 = healthCheckVaccine.get(1);
    	List<String> header93= new LinkedList<>();
    	header93.add("");
    	header93.add(vaccine2.get("vaccineName").toString());
    	header93.add("");
    	header93.add(vaccine2.get("vaccineTime").toString());
    	header93.add(vaccine2.get("vaccinehos").toString());
    	header93.add("");
    	header93.add("");
    	header93.add("");
    	writer.writeHeadRow(header93);
    	writer.merge(87,87,1,2,null,false);
    	writer.merge(87,87,4,7,null,false);


    	
    	//调整列宽度
    	writer.setColumnWidth(0,20);
    	writer.setColumnWidth(1,15);
    	writer.setColumnWidth(2,15);
    	writer.setColumnWidth(3,20);
    	writer.setColumnWidth(4,15);
    	writer.setColumnWidth(5,20);
    	writer.setColumnWidth(6,10);
    	writer.setColumnWidth(7,20);
    	
         response.setContentType("application/vnd.ms-excel;charset=utf-8");
         String fileName = new String("健康体检表".getBytes(StandardCharsets.UTF_8),StandardCharsets.ISO_8859_1);
         response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xls");
         ServletOutputStream out = null;
         try {
              out = response.getOutputStream();
              writer.flush(out, true);
         } catch (IOException e) {
              e.printStackTrace();
         } finally {
              // 关闭writer，释放内存
              writer.close();
         }
         //此处记得关闭输出Servlet流
         IoUtil.close(out);
    }
    
    //症状
    public String basicSymptoms(String param){
    	String res = "";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("bs25", "其他").replace("bs24", "乳房胀痛").replace("bs23", "耳鸣").replace("bs22", "眼花").replace("bs21", "恶心呕吐")
    				.replace("bs20", "腹泻").replace("bs19", "便秘").replace("bs18", "尿痛").replace("bs17", "尿急").replace("bs16", "手脚麻木")
    				.replace("bs15", "视力模糊").replace("bs14", "关节肿痛").replace("bs13", "乏力").replace("bs12", "体重下降").replace("bs11", "多尿")
    				.replace("bs10", "多饮").replace("bs9", "呼吸困难").replace("bs8", "咳痰").replace("bs7", "慢性咳嗽").replace("bs6", "胸痛")
    				.replace("bs5", "胸闷").replace("bs4", "心悸").replace("bs3", "头晕").replace("bs2", "头痛").replace("bs1", "无症状")
    				
    				
    				
    				;
    		return res;
    	}else{
    		return "";
    	}	
    }

	//饮食习惯
	public String dietRadio(String param){
		String res = "";
		if(StringUtils.isNotEmpty(param)){
			res = param.replace("dr1", "荤素均衡").replace("dr2", "荤食为主").replace("dr3", "素食为主").replace("dr4", "嗜盐").replace("dr5", "嗜油").replace("dr6", "嗜糖");
			return res;
		}else{
			return "";
		}
	}
	//饮酒种类
	public String drinkingTypeRadio(String param){
		String res = "";
		if(StringUtils.isNotEmpty(param)){
			res = param.replace("dt1", "白酒").replace("dt2", "啤酒").replace("dt3", "红酒").replace("dt4", "黄酒").replace("dt5", "其他");
			return res;
		}else{
			return "";
		}
	}
    
    public  String nullToString(String param){
    	if(StringUtils.isNotEmpty(param)){
    		return param;
    	}else{
    		return "";
    	}
    }
    //老年人健康状态自我评估
    public String jkztRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("5", "不满意").replace("4", "不太满意").replace("3", "说不清楚")
    				.replace("2", "基本满意").replace("1", "满意");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    
    //老年人生活自理能力自我评估
    public String zlnlRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("4", "不能自理(>=19分)").replace("3", "中度依赖(9~18分)")
    				.replace("2", "轻度依赖(4~8分)").replace("1", "可自理(0~3分)");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    
    //老年人认知功能
    public String rzgnRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("2", "粗筛阳性").replace("1", "粗筛阴性");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //锻炼频率
    public String exerciseRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("4", "不锻炼").replace("3", "偶尔")
    				.replace("2", "每周一次以上").replace("1", "每天");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //饮食习惯
//    public String dietRadio(String param){
//    	String res="";
//    	if(StringUtils.isNotEmpty(param)){
//    		res = param.replace("6", "嗜糖").replace("5", "嗜由").replace("4", "嗜盐").replace("3", "素食为主")
//    				.replace("2", "荤食为主").replace("1", "荤素均衡");
//    		return res;
//    	}else{
//    		return "";
//    	}
//    }
    //吸烟状况
    public String smokeRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("3", "吸烟").replace("2", "已戒烟").replace("1", "从不吸烟");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //饮酒频率drinkingRadio
    public String drinkingRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("4", "每天").replace("3", "经常")
    				.replace("2", "偶尔").replace("1", "从不");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    
    
    //是否戒酒
    public String noDrinkingRadio(String param,String param2){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("2", "已戒酒").replace("1", "未戒酒");
    		if(StringUtils.isNotEmpty(param2)){
    			res = res+",戒酒年龄"+param2+"岁";
    		}
    		return res;
    	}else{
    		return "";
    	}   	
    }
    
    //近一年内是否曾醉酒
    public String drunkRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("2", "否").replace("1", "是");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    
    //饮酒种类 
//    public String drinkingTypeRadio(String param){
//    	String res="";
//    	if(StringUtils.isNotEmpty(param)){
//    		res = param.replace("5", "其他").replace("4", "黄酒").replace("3", "红酒")
//    				.replace("2", "啤酒").replace("1", "白酒");
//    		return res;
//    	}else{
//    		return "";
//    	}
//    }
    //   职业病危害因素接触史/杂音/压痛/包块/肝大/脾大/移动性浊音
    public String zybRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("2", "有").replace("1", "无");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //毒物种类
    public String dwRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("2", "无").replace("1", "有");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //口唇
    public String kcRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("5", "疱疹").replace("4", "皲裂").replace("3", "发绀酒")
    				.replace("2", "苍白").replace("1", "红润");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //齿列
    public String clRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("4", "义齿(假牙)").replace("3", "龋齿")
    				.replace("2", "缺齿").replace("1", "正常");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //咽部
    public String ybRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("3", "淋巴滤泡增生")
    				.replace("2", "充血").replace("1", "无充血");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //听力
    public String tlRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("2", "听不清或无法听见").replace("1", "听见");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //运动功能 
    public String ydgnRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("2", "无法独立完成任何一个动作").replace("1", "顺利完成");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //眼底 /心电图/B超
    public String ydRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("2", "异常").replace("1", "正常");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //皮肤
    public String pfRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("7", "其他").replace("6", "色素沉着")
    				.replace("5", "黄染").replace("4", "发绀")
    				.replace("3", "苍白").replace("2", "潮红")
    				.replace("1", "正常");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //巩膜
    public String hmRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("4", "其他")
    				.replace("3", "充血").replace("2", "黄染")
    				.replace("1", "正常");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //淋巴结
    public String lbjRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("4", "其他")
    				.replace("3", "腋窝").replace("2", "锁骨上")
    				.replace("1", "未触及");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //桶状胸
    public String tzxRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("2", "是").replace("1", "否");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //呼吸音
    public String hxyRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("2", "异常").replace("1", "正常");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //罗音
    public String lyRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("4", "其他")
    				.replace("3", "湿罗音").replace("2", "干罗音")
    				.replace("1", "无");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //心率状态
    public String xlradio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("3", "绝对不齐").replace("2", "不齐")
    				.replace("1", "齐");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //下肢水肿
    public String xzszRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("4", "双侧对称")
    				.replace("3", "双侧部队称").replace("2", "单侧")
    				.replace("1", "无");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //足背动脉搏动
    public String zbdmbdRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("4", "触及右侧弱或消失")
    				.replace("3", "触及左侧弱或消失").replace("2", "触及双侧对称")
    				.replace("1", "未触及");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //脑血管疾病
    public String nxgjbRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("6", "其他").replace("5", "短暂性脑缺血发作")
    				.replace("4", "蛛网膜下腔出血").replace("3", "脑出血")
    				.replace("2", "缺血性卒中").replace("1", "未发现");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //肾脏疾病
    public String szjbRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("6", "其他").replace("5", "慢性胃炎")
    				.replace("4", "急性胃炎").replace("3", "肾功能衰竭")
    				.replace("2", "糖尿病肾病").replace("1", "未发现");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //xzjbRadio心脏疾病
    public String xzjbRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("5", "充血性心力衰竭")
    				.replace("4", "冠状动脉血运重建").replace("3", "心绞痛")
    				.replace("2", "心肌梗死").replace("1", "未发现");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    //血管疾病
    public String xgjbRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("4", "其他").replace("3", "动脉闭塞疾病")
    				.replace("2", "夹层动脉瘤").replace("1", "未发现");
    		return res;
    	}else{
    		return "";
    	}   	
    } 
    //眼部疾病
    public String ybjbRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("5", "其他")
    				.replace("4", "白内障").replace("3", "视乳头水肿")
    				.replace("2", "视网膜出血或渗出").replace("1", "未发现");
    		return res;
    	}else{
    		return "";
    	}   	
    }
    
    //神经系统疾病/其他系统疾病
    public String sjxtjbRadio(String param){
    	String res="";
    	if(StringUtils.isNotEmpty(param)){
    		res = param.replace("2", "有").replace("1", "未发现");
    		return res;
    	}else{
    		return "";
    	}   	
    }
   //住院史/家庭病床史 
   public List<Map<String,Object>> healthCheckHos(List<Map<String,Object>> param){
	   Map<String,Object> map = new HashMap<String,Object>();
	   map.put("inHospital", "");
	   map.put("outHospital", "");
	   map.put("why", "");
	   map.put("hosName", "");
	   map.put("medNo", "");
	   if(param.size()==0){
		   param.add(map);
		   param.add(map);
	   }else if(param.size()==1){
		   param.add(map);
	   }
	   return param;
   }
    
   //主要用药情况（问诊）
   public List<Map<String,Object>> healthCheckMed(List<Map<String,Object>> param){
	   Map<String,Object> map = new HashMap<String,Object>();
	   map.put("medName", "");
	   map.put("useWay", "");
	   map.put("useNum", "");
	   map.put("useTime", "");
	   map.put("fyycxRadio", "");
	   if(param.size()==0){
		   param.add(map);
		   param.add(map);
	   }else if(param.size()==1){
		   param.add(map);
	   }
	   return param;
   }
   //非免疫规划预防接种史（问诊) 
   public List<Map<String,Object>> healthCheckVaccine(List<Map<String,Object>> param){
	   Map<String,Object> map = new HashMap<String,Object>();
	   map.put("vaccineName", "");
	   map.put("vaccineTime", "");
	   map.put("vaccinehos", "");
	   if(param.size()==0){
		   param.add(map);
		   param.add(map);
	   }else if(param.size()==1){
		   param.add(map);
	   }
	   return param;
   }

	/**
	 * 左侧树
	 * @param request
	 * @param response
	 * @return
	 */
   @RequestMapping("/geteCunRenShu")
   public List<Map<String,Object>> geteCunRenShu(HttpServletRequest request, HttpServletResponse response){
	    //医院编号
	    String hosnum = request.getParameter("hosnum");
        return healthCheckService.geteCunRenShu(hosnum);
   }
    
}
